﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LeoK.Common;
using Telerik.Windows.Documents.FormatProviders;

namespace LeoK.TM.Entity
{
    public class TM_Question : EntityBase
    {
        private int _id;
        private int _sid;
        private string _name;
        private string _description;
        private QuestionLevel _level;
        private QuestionStatus _status;
        private DateTime _createTime;
        private DateTime _fixTime;
        private QuestionType _type;
        private string _note;

        [EB(IsReadOnly = true)]
        public int ID
        {
            get { return _id; }
            set
            {
                _id = value;
                OnPropertyChanged();
            }
        }
        
        [Display(Name = "所属项目")]
        [EBAttribute(AllowFilter = true)]
        public int SID
        {
            get { return _sid; }
            set
            {
                _sid = value; 
                OnPropertyChanged();
            }
        }

        [Display(Name = "标题")]
        public string Name
        {
            get { return _name; }
            set
            {
                _name = value;
                OnPropertyChanged();
            }
        }

        [Display(Name = "描述")]
        public string Description
        {
            get { return _description; }
            set
            {
                _description = value; 
                OnPropertyChanged();
            }
        }

        [Display(Name = "等级")]
        public QuestionLevel Level
        {
            get { return _level; }
            set
            {
                _level = value; 
                OnPropertyChanged();
            }
        }

        [Display(Name = "状态")]
        [EBAttribute(AllowFilter = true)]
        public QuestionStatus Status
        {
            get { return _status; }
            set
            {
                _status = value;
                OnPropertyChanged();
            }
        }

        [Display(Name = "类型")]
        public QuestionType Type
        {
            get { return _type; }
            set
            {
                _type = value;
                OnPropertyChanged();
            }
        }

        [EB(IsReadOnly = true)]
        [Display(Name = "创建时间")]
        public DateTime CreateTime
        {
            get { return _createTime; }
            set
            {
                _createTime = value; 
                OnPropertyChanged();
            }
        }

        [EB(IsReadOnly = true)]
        [Display(Name = "解决时间")]
        public DateTime FixTime
        {
            get { return _fixTime; }
            set
            {
                _fixTime = value;
                OnPropertyChanged();
            }
        }

        [Display(Name = "备注")]
        public string Note
        {
            get { return _note; }
            set
            {
                _note = value;
                OnPropertyChanged();
            }
        }

        public TM_Question()
        {
            Name = "新问题";
            CreateTime = DateTime.Now;
            FixTime = DateTime.Now;
        }
    }

    public enum QuestionLevel
    {
        低,
        一般,
        中,
        高,
        较高,
        最高
    }

    public enum QuestionStatus
    {
        未解决,
        已解决,
        重现,
        已实现
    }

    public enum QuestionType
    {
        需求,
        缺陷
    }
}
